(function($) {
    $.validator.addMethod("phoneProc", function(value, element) {
        var phone = bdbMain.attr.regExp.phone;
        return phone.test(value);
    });

    $.validator.addMethod("ipProc", function(value, element) {
        var ip = bdbMain.attr.regExp.ip;
        return ip.test(value);
    });

    $.validator.addMethod("pwdProc", function(value, element) {
        var pwd = bdbMain.attr.regExp.pwd;
        return pwd.test(value);
    });

    $.validator.addMethod("emailProc", function(value, element) {
        var email = bdbMain.attr.regExp.email;
        return email.test(value);
    });

    $.validator.addMethod("domainProc", function(value, element) {
        var domain = bdbMain.attr.regExp.domain;
        return domain.test(value);
    });

    $.validator.addMethod("urlProc", function(value, element) {
        var url = bdbMain.attr.regExp.url;
        return url.test(value);
    });

    $.validator.addMethod("cnameProc", function(value, element) {
        var cname = bdbMain.attr.regExp.cname;
        return cname.test(value);
    });

    $.validator.addMethod("srcTplMasterProc", function(value, element) {
        var type = $(element).parents(".form-group").find(".js-bdb-srcTplType").val();
        if(type == 'A'){
            var ip = bdbMain.attr.regExp.ip;
            return ip.test(value);
        }else{
            var cname = bdbMain.attr.regExp.cname;
            return cname.test(value);
        }
    });

    $.validator.addMethod("srcTplSlaveProc", function(value, element) {
        var type = $(element).parents(".form-group").find(".js-bdb-srcTplType").val();

        if(type == 'A'){
            var ip = bdbMain.attr.regExp.ip;
            return ip.test(value);
        }else{
            return true;
        }
    });

    $.validator.addMethod("srcTplMSCompareProc", function(value, element) {
        var element = $(element),
            type = element.parents(".form-group").find(".js-bdb-srcTplType").val();

        if(type == 'A'){
            return !(value == element.parent().prev().find("input").val());
        }else{
            return true;
        }
    });

    $.validator.addMethod("srcTplMRequiredProc", function(value, element) {
        var element = $(element),
            type = element.parents(".form-group").find(".js-bdb-srcTplType").val();

        if(type == 'A'){
            return !(element.parent().prev().find("input").val() == '');
        }else{
            return true;
        }
    });

    $.validator.addMethod("storageCompareProc", function(val, ele) {
        if(val == $('#bdb-domain-master-storage').val()){
            return false;
        }else{
            return true;
        }
    });
})(jQuery)
